<template>
  <div class="custom-wrap total-wrap">
    <div
      class="header"
      style="height: 100px; background: #e2e6ed; position: relative"
    >
      <div style="color: #000; font-size: 28px; margin-bottom: 15px">
        新进人员后勤服务申请表
      </div>
      <!-- <div style="position:absolute;right: 20px;bottom: 5px;">
            <span>申请人： {{userInfo.realname}}</span><span style="margin-left: 25px">申请人时间：{{date}}</span>
        </div> -->
      <!-- <el-button type="text" icon="el-icon-printer" class="new-print-btn noprint" v-print="printObj"></el-button> -->
      <el-button
        type="text"
        icon="el-icon-printer"
        class="new-print-btn noprint"
        v-print="printObj"
        >打印</el-button
      >
      <!-- <el-button type="primary" style="position:absolute;right: 10px;" icon="el-icon-printer" class="noprint" v-print="printObj">打印</el-button> -->
    </div>
    <!-- <el-form :model="ruleForm" ref="ruleForm" :rules="rules" label-width="193px"> -->
    <el-form :model="ruleForm" ref="ruleForm" label-width="193px">
      <!-- <div class="disable-block" v-if="detailObj && detailObj.status && detailObj.taskName !== '发起人'"></div> -->
      <el-row type="flex" align="center">
        <el-col class="no-border" :span="24">
          <el-row>
            <el-col :span="12">
              <el-form-item label="发起人">
                {{
                  (detailObj && detailObj.applyRealname) || userInfo.realname
                }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请部门">
                {{
                  (detailObj && detailObj.applyDeptName) || userInfo.deptName
                }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="联系电话">
                {{ (detailObj && detailObj.createPhone) || userInfo.phone }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请时间" prop="createTime">
                <el-date-picker
                  v-model="ruleForm && ruleForm.createTime"
                  type="date"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  placeholder="请选择申请时间"
                  value-format="yyyy-MM-dd"
                  format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="申请人" prop="newStaffName">
                <el-input
                  v-model="ruleForm && ruleForm.newStaffName"
                  placeholder="请输入申请人"
                  :maxlength="32"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请人联系电话" prop="newStaffPhone">
                <el-input
                  v-model="ruleForm && ruleForm.newStaffPhone"
                  placeholder="请输入申请人联系电话"
                  :maxlength="18"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="人员类型" prop="newStaffType">
                <el-select
                  v-model="ruleForm.newStaffType"
                  placeholder="请选择人员类型"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  clearable
                  @change="choseRy"
                >
                  <el-option
                    v-for="item in optionRylb"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="办公地点" prop="newStaffAddr">
                <el-select
                  v-model="ruleForm.newStaffAddr"
                  placeholder="请选择办公地点"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  clearable
                >
                  <el-option
                    v-for="item in optionBgdd"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
                <!-- <el-input  v-model="ruleForm && ruleForm.newStaffAddr" placeholder="请输入办公地点" :maxlength="255" :disabled="detailObj && detailObj.status && detailObj.taskName !== '发起人'"></el-input> -->
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item prop="attachment" class="upload-content">
                <label
                  for="attachment"
                  slot="label"
                  style="
                    display: inline-block;
                    height: 151px;
                    line-height: 1;
                    padding-top: 50px;
                  "
                  >附件上传<br /><span class="tip-grey"
                    >借调人员或挂职人员需上传借调（挂职）文件和保密承诺书；劳务派遣人员需上传与省局签订的合同和保密承诺书</span
                  ></label
                >
                <el-upload
                  class="upload-demo"
                  :headers="headers"
                  :limit="2"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  action="/act/file/upload"
                  :on-success="handleSuccess"
                  :on-preview="download"
                  :on-remove="handleRemove"
                  :before-upload="beforeUpload"
                  :file-list="fileList"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
                <p class="url-block">
                  保密承诺书模板：<a
                    href="/templet/保密承诺书（适用劳务派遣人员）.doc"
                    >劳务派遣人员</a
                  ><a href="/templet/保密承诺书（适用外包服务人员）.doc"
                    >外包服务人员</a
                  ><a href="/templet/保密承诺书（适用正式税务人员）.doc"
                    >正式税务人员</a
                  >
                </p>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item prop="applyTimes" class="applyTimes-items">
                <label
                  for="applyTimes"
                  slot="label"
                  style="
                    display: inline-block;
                    height: 70px;
                    line-height: 1;
                    padding-top: 20px;
                  "
                  >申请日期<br /><span class="tip-grey"
                    >需与正式文件一致</span
                  ></label
                >
                <span class="red-star"></span>
                <el-date-picker
                  v-model="ruleForm.startDate"
                  type="date"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  class="date-half-block"
                  placeholder="请选择开始日期"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  format="yyyy-MM-dd"
                >
                </el-date-picker>
                <el-date-picker
                  v-model="ruleForm.endDate"
                  type="date"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                  class="date-half-block"
                  placeholder="请选择结束日期"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  format="yyyy-MM-dd"
                >
                </el-date-picker>
                <span class="tip-grey">不填结束日期视同长期有效</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <el-row type="flex" align="center">
        <el-col :span="4">
          <div
            style="
              height: 100%;
              display: flex;
              align-items: center;
              justify-content: center;
              font-size: 16px;
            "
          >
            申请类型
          </div>
        </el-col>
        <el-col class="no-border" :span="20">
          <el-row>
            <el-col :span="24">
              <el-form-item label-width="120px">
                <label
                  label-width
                  slot="label"
                  style="
                    display: inline-block;
                    height: 202px;
                    line-height: 202px;
                  "
                  >工作证需求</label
                >
                <el-radio-group
                  v-model="radio1"
                  class="radio-group-custom"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                >
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label-width="120px">
                      <label
                        label-width
                        slot="label"
                        style="
                          display: inline-block;
                          height: 151px;
                          line-height: 151px;
                        "
                        >房间号</label
                      >
                      <el-input
                        v-model="ruleForm.idCard && ruleForm.idCard.roomNo"
                        :maxlength="20"
                        placeholder="请输入房间号"
                        :disabled="
                          radio1 === 0 ||
                          detailObj &&
                          detailObj.status &&
                          detailObj.taskName !== '发起人' &&
                          detailObj.taskName !== '机关服务中心综合岗意见'
                        "
                      ></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label-width="120px">
                      <label
                        label-width
                        slot="label"
                        style="
                          display: inline-block;
                          height: 151px;
                          line-height: 151px;
                        "
                        >照片</label
                      >
                      <el-upload
                        :headers="headers"
                        :show-file-list="false"
                        :on-success="handleAvatarSuccess"
                        :disabled="
                          radio1 === 0 ||
                          detailObj &&
                          detailObj.status &&
                          detailObj.taskName !== '发起人' &&
                          detailObj.taskName !== '机关服务中心综合岗意见'
                        "
                        class="avatar-uploader"
                        action="/act/file/upload"
                      >
                        <div class="avatar-block" v-if="cover">
                          <img
                            id="avatar"
                            :src="avatarUrl"
                            style="max-height: 151px"
                            class="avatar"
                          />
                          <i
                            class="el-icon-delete"
                            v-if="
                              !(
                                detailObj &&
                                detailObj.status &&
                                detailObj.taskName !== '发起人' &&
                                detailObj.taskName !== '机关服务中心综合岗意见'
                              )
                            "
                            @click.stop="deleteImg"
                          ></i>
                        </div>
                        <i v-else class="el-icon-plus avatar-uploader-icon" />
                      </el-upload>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label-width="120px">
                <label label-width slot="label" style="display: inline-block"
                  >用餐需求</label
                >
                <el-radio-group
                  v-model="radio2"
                  class="radio-group-custom"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                >
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label-width="120px">
                <label
                  label-width
                  slot="label"
                  style="display: inline-block"
                  :style="{
                    height: bjFlag1 ? '284px' : '132px',
                    'line-height': bjFlag1 ? '284px' : '132px',
                  }"
                  >住房需求</label
                >
                <el-radio-group
                  v-model="radio3"
                  class="radio-group-custom"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                >
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      label-width="120px"
                      class="upload-content-new"
                    >
                      <label
                        label-width
                        slot="label"
                        style="
                          display: inline-block;
                          height: 80px;
                          line-height: 80px;
                        "
                      >
                        <a
                          href="/templet/省税务局机关公有住房申请表.xlsx"
                          class="url-block"
                          >公有住房申请表</a
                        ></label
                      >
                      <el-upload
                        class="upload-demo-new"
                        :headers="headers"
                        :disabled="
                          radio3 === 0 ||
                          detailObj &&
                          detailObj.status &&
                          detailObj.taskName !== '发起人' &&
                          detailObj.taskName !== '机关服务中心综合岗意见'
                        "
                        action="/act/file/upload"
                        :on-success="handleSuccess2"
                        :on-preview="download2"
                        :on-exceed="handexceed"
                        :limit="1"
                        :before-upload="beforeUpload"
                        :on-remove="handleRemove2"
                        :file-list="fileList2"
                      >
                        <el-button size="small" type="primary"
                          >点击上传</el-button
                        >
                      </el-upload>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      label-width="120px"
                      class="upload-content-new"
                    >
                      <label
                        label-width
                        slot="label"
                        style="
                          display: inline-block;
                          height: 80px;
                          line-height: 80px;
                        "
                        ><a :href="hrefUrl" class="url-block"
                          >个人住房承诺书</a
                        ></label
                      >
                      <el-upload
                        class="upload-demo-new"
                        :headers="headers"
                        action="/act/file/upload"
                        :disabled="
                          radio3 === 0 ||
                          detailObj &&
                          detailObj.status &&
                          detailObj.taskName !== '发起人' &&
                          detailObj.taskName !== '机关服务中心综合岗意见'
                        "
                        :on-success="handleSuccess1"
                        :on-exceed="handexceed"
                        :on-preview="download1"
                        :limit="1"
                        :before-upload="beforeUpload"
                        :on-remove="handleRemove1"
                        :file-list="fileList1"
                      >
                        <el-button size="small" type="primary"
                          >点击上传</el-button
                        >
                      </el-upload>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row v-if="bjFlag1">
                  <el-col :span="24">
                    <el-form-item label="地址" label-width="120px">
                      <el-input
                        disabled
                        :style="{
                          width:
                            form1 && form1.housingType == '2'
                              ? '510px'
                              : '100%',
                        }"
                        v-model="form1 && form1.address"
                      >
                        <el-button
                          style="
                            color: #fff;
                            background: #409eff;
                            border-color: #409eff;
                          "
                          slot="append"
                          @click="choseHouse"
                          >选择公有住房</el-button
                        >
                      </el-input>
                      <el-select
                        v-model="form1 && form1.bedNumber"
                        v-if="form1 && form1.housingType == '2'"
                        @change="changeBed"
                        :disabled="!bjFlag"
                        style="width: 190px; margin-left: 10px"
                        placeholder="请选择床位"
                        clearable
                      >
                        <el-option
                          v-for="item in optionsBed"
                          :key="item.bedId"
                          :label="item.bedNumber"
                          :value="item.bedId"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row v-if="bjFlag1">
                  <el-col :span="12">
                    <el-form-item label="建筑面积（m²）" label-width="120px">
                      <span>{{ form1 && form1.constructionArea }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" class="borderLeft">
                    <el-form-item label="公有住房类型" label-width="120px">
                      <el-select
                        v-model="form1 && form1.housingType"
                        placeholder="请选择公有住房类型"
                        disabled
                        clearable
                      >
                        <el-option
                          v-for="item in optionsHouseType"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row v-if="bjFlag1">
                  <el-col :span="12">
                    <el-form-item label="计租面积（m²）" label-width="120px">
                      <span>{{ form1 && form1.rentArea }}</span>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      label="租金（元）"
                      label-width="120px"
                      class="borderLeft"
                    >
                      <span>{{ form1 && form1.defaultRent }}</span>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label-width="120px">
                <label
                  label-width
                  slot="label"
                  style="
                    display: inline-block;
                    height: 100px;
                    line-height: 100px;
                  "
                  >停车需求</label
                >
                <el-radio-group
                  v-model="radio4"
                  class="radio-group-custom"
                  :disabled="
                    detailObj &&
                    detailObj.status &&
                    detailObj.taskName !== '发起人' &&
                    detailObj.taskName !== '机关服务中心综合岗意见'
                  "
                >
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
                <el-row>
                  <el-col :span="24">
                    <el-form-item label-width="120px">
                      <label
                        label-width
                        for="plateNo"
                        slot="label"
                        style="
                          display: inline-block;
                          height: 50px;
                          line-height: 50px;
                        "
                        >车牌号码</label
                      >
                      <el-input
                        v-model="ruleForm.parking.plateNo"
                        :maxlength="20"
                        :disabled="
                          radio4 === 0 ||
                          detailObj &&
                          detailObj.status &&
                          detailObj.taskName !== '发起人' &&
                          detailObj.taskName !== '机关服务中心综合岗意见'
                        "
                      ></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >部门领导意见</label
            >
            <div class="flex-block">{{ bmldsp }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >机关服务中心综合岗意见</label
            >
            <div class="flex-block">{{ rscsp }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >{{ activeTaskName }}</label
            >
            <div class="flex-block">{{ zczyj }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >机关服务中心分管领导意见</label
            >
            <div class="flex-block">{{ fwzxfgldyj }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >机关服务中心经办人办理</label
            >
            <div class="flex-block">{{ fwzxzyldyj }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row align="center">
        <el-col :span="24">
          <el-form-item label-width="193px">
            <label
              label-width
              slot="label"
              style="display: inline-block; height: 100px; line-height: 100px"
              >发起人阅知办结</label
            >
            <div class="flex-block">{{ fqr }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row
        align="center"
        v-if="!detailObj.code || (detailObj && detailObj.taskName === '发起人')"
      >
        <el-col :span="24" class="btn-group-col noprint">
          <el-form-item>
            <el-select
              v-model="assignee"
              class="manager-select"
              multiple
              v-if="
                !detailObj.code ||
                (detailObj &&
                  detailObj.taskName === '发起人' &&
                  detailObj.showSelectType)
              "
              style="width: 220px !important; margin-right: 10px"
              placeholder="请选择部门领导"
              clearable
            >
              <el-option
                v-for="item in optionsUser"
                :key="item.userId"
                :label="item.realname"
                :value="item.username"
              >
              </el-option>
            </el-select>
            <el-button
              type="primary"
              icon="el-icon-check"
              @click="submitForm('ruleForm')"
              >提交</el-button
            >
            <el-button
              v-if="!(detailObj && detailObj.status)"
              icon="el-icon-delete"
              @click="close"
              >关闭</el-button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-dialog
      :visible.sync="modalHouse1"
      v-if="modalHouse1"
      title="公有住房"
      width="1200px"
      top="2vh"
      @close="close1"
      :close-on-click-modal="false"
      append-to-body
    >
      <a-table
        :row-key="'housingId'"
        :columns="columns2"
        :scroll="{ y: 'calc(100vh - 364px)' }"
        :data-source="allmemberList1"
        :row-selection="{
          selectedRowKeys: selectedRowKeys1,
          type: 'radio',
          onChange: selectMembers1,
          columnTitle: ' ',
        }"
        bordered
        :pagination="page2"
        :loading="loading1"
        @change="handleTableChange1"
      >
        <template slot="housingType" slot-scope="text, record">
          <span>
            {{ record.housingTypeName }}
          </span>
        </template>
        <template slot="structure" slot-scope="text, record">
          <span>
            {{ record.strueName }}
          </span>
        </template>
        <template slot="toward" slot-scope="text, record">
          <span>
            {{ record.towaName }}
          </span>
        </template>
        <template slot="status" slot-scope="text, record">
          <span>
            {{ record.statusName }}
          </span>
        </template>
      </a-table>
      <div class="btn-footer">
        <el-button type="primary" @click="dataSubmit">确 定</el-button>
        <el-button @click="close1">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog
      class="error"
      :modal="false"
      title="温馨提示"
      :visible.sync="centerDialogVisible"
      width="360px"
      center
    >
      <span>文件类型非法，您可以尝试将文件压缩后重新上传</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="centerDialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script type="text/ecmascript-6">
import { getCurrentDate } from "@/util/date";
import { mapGetters } from "vuex";
import { userSelectAll } from "@/api/admin/user";
import chooseMember from "@/components/chooseMember";
import { startProcess, billSubmit } from "@/api/bill";
import { fetchList } from "@/api/housing/housingbed";
import { fetchList as fetchList1 } from "@/api/housing/housing";
import store from "@/store";
import { findByvalue } from "@/util/util";
import { remote } from "@/api/admin/dict";
export default {
  components: { chooseMember },
  props: ["formObj", "detailObj", "form1"],
  data() {
    return {
      cover: "",
      avatarUrl: "",
      yjjy: "",
      modalHouse1: false,
      centerDialogVisible: false, //控制弹窗
      optionsHouseType: [],
      page2: {
        total: 0, // 总页数
        current: 1, // 当前页数
        pageSize: 20, // 每页显示多少条,
        isAsc: false, // 是否倒序
      },
      selectedRowKeys1: [],
      allmemberList1: [],
      chosememberList1: [],
      hrefUrl: "/templet/公有住房 承诺书（在职干部、职工）.docx",
      optionBgdd: [
        {
          label: "潭村办公楼",
          value: "潭村办公楼",
        },
        {
          label: "中山二路",
          value: "中山二路",
        },
        {
          label: "五山",
          value: "五山",
        },
      ],
      columns2: [
        {
          title: "地址",
          dataIndex: "address",
          key: "address",
          width: 300,
        },
        {
          title: "房号",
          dataIndex: "roomNumber",
          key: "roomNumber",
        },
        {
          title: "房屋类型",
          dataIndex: "housingType",
          key: "housingType",
          scopedSlots: { customRender: "housingType" },
        },
        {
          title: "室内结构",
          dataIndex: "structure",
          scopedSlots: { customRender: "structure" },
          key: "structure",
        },
        {
          title: "朝向",
          dataIndex: "toward",
          scopedSlots: { customRender: "toward" },
          key: "toward",
        },
        {
          title: "建筑面积",
          dataIndex: "constructionArea",
          key: "constructionArea",
        },
        {
          title: "使用面积",
          dataIndex: "usageArea",
          key: "usageArea",
        },
        {
          title: "使用状态",
          dataIndex: "status",
          scopedSlots: { customRender: "status" },
          key: "status",
        },
      ],
      optionsBed: [],
      optionsUser: [],
      assignee: [],
      date: getCurrentDate(),
      printObj: {
        id: "printForm", //打印区域 Dom ID
        popTitle: "打印页面标题文字",
        ignoreClass: "noprint",
        extraCss: "https://www.google.com,https://www.google.com",
        extraHead:
          '<meta http-equiv="Content-Language"content="zh-cn"/>,<style> #printForm { height: auto !important; } <style>', //  可以传进去  style tag 标签；注意要逗号分隔   解决特定区域不显示问题；
      },
      activeTaskName: "机关服务中心科组意见",
      radio1: 0,
      radio2: 0,
      radio3: 0,
      radio4: 0,
      bmldsp: "",
      rscsp: "",
      zczyj: "",
      fwzxfgldyj: "",
      fwzxzyldyj: "",
      fqr: "",
      ruleForm: {
        billChecked: [],
        createTime: getCurrentDate("year"),
        newStaffName: "",
        newStaffPhone: "",
        newStaffAddr: "",
        newStaffType: "",
        startDate: "",
        endDate: "",
        idCard: {},
        housing: {},
        parking: {},
        applyTimes: [],
        attachment: [],
      },
      keyNum: 0,
      // form1: {},
      form2: {},
      bjFlag: false,
      bjFlag1: false,
      loading1: false,
      selectedRowKeys1: [],
      listLoading: true,
      list: [],
      rules: {
        createTime: [{ required: true, message: "请选择申请时间" }],
        newStaffType: [{ required: true, message: "请选择人员类型" }],
        newStaffName: [{ required: true, message: "请输入申请人" }],
        newStaffPhone: [{ required: true, message: "请输入申请人联系电话" }],
        newStaffAddr: [{ required: true, message: "请选择办公地点" }],
      },
      sqbmyj: "",
      wyldyj: "",
      wyjbryj: "",
      optionRylb: [],
      fileList: [],
      fileList1: [],
      fileList2: [],
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    headers() {
      return {
        Authorization: "Bearer " + store.getters.access_token,
      };
    },
  },
  created() {
    userSelectAll("ROLE_DEPT_LEADER", this.userInfo.username).then((res) => {
      this.optionsUser = res.data.data;
    });
    if (this.detailObj && this.detailObj.status) {
      this.ruleForm = Object.assign({}, this.detailObj);
      this.ruleForm.startDate = this.detailObj.applyBeginTime;
      this.ruleForm.endDate = this.detailObj.applyEndTime;
      this.ruleForm = Object.assign({}, this.ruleForm);

      // 资产组处理后不显示问题
      if (typeof this.detailObj.attachment === "string") {
        this.fileList = JSON.parse(this.detailObj.attachment);
      } else {
        this.fileList = this.detailObj.attachment || [];
      }

      this.radio1 = this.detailObj.billChecked.some((item) => {
        return item === 1;
      })
        ? 1
        : 0;
      this.radio2 = this.detailObj.billChecked.some((item) => {
        return item === 2;
      })
        ? 1
        : 0;
      this.radio3 = this.detailObj.billChecked.some((item) => {
        return item === 3;
      })
        ? 1
        : 0;
      this.radio4 = this.detailObj.billChecked.some((item) => {
        return item === 4;
      })
        ? 1
        : 0;
      this.cover = this.avatarUrl =
        this.detailObj.idCard && this.detailObj.idCard.pic
          ? this.detailObj.idCard.pic
          : "";
      this.fileList1 = this.detailObj.fileList1 ? this.detailObj.fileList1 : [];
      this.fileList2 = this.detailObj.fileList2 ? this.detailObj.fileList2 : [];
      let keyword;
      this.detailObj.commitList.map((citem) => {
        if (citem.taskStatus === "1") {
          if (citem.taskName === "部门领导意见") {
            keyword = "bmldsp";
          } else if (citem.taskName === "机关服务中心综合岗意见") {
            keyword = "rscsp";
          } else if (citem.taskName === "发起人阅知办结") {
            keyword = "fqr";
          } else if (citem.taskName === "机关服务中心分管领导意见") {
            keyword = "fwzxfgldyj";
          } else if (citem.taskName === "机关服务中心经办人办理") {
            keyword = "fwzxzyldyj";
          } else if (
            citem.taskName === "机关服务中心资产组意见" ||
            citem.taskName === "机关服务中心膳食组意见" ||
            citem.taskName === "机关服务中心物业组意见"
          ) {
            keyword = "zczyj";
          } else {
            keyword = "bj";
          }
          this[keyword] =
            "【" +
            citem.deptName +
            "-" +
            citem.realname +
            "】:" +
            (citem.message ? citem.message : "") +
            "。（" +
            citem.time +
            "）";
        }
        if (
          citem.subStatus === 1 &&
          (citem.taskName === "机关服务中心资产组意见" ||
            citem.taskName === "机关服务中心物业组意见" ||
            citem.taskName === "机关服务中心膳食组意见")
        ) {
          this.activeTaskName = citem.taskName;
        }
        if (this.detailObj.subType === "1") {
          this.activeTaskName = "机关服务中心物业组意见";
          if (citem.message && citem.taskName === "机关服务中心物业组意见") {
            this.yjjy =
              "【" +
              citem.deptName +
              "-" +
              citem.realname +
              "】:" +
              (citem.message ? citem.message : "") +
              "。（" +
              citem.time +
              "）";
          }
        } else if (this.detailObj.subType === "2") {
          this.activeTaskName = "机关服务中心膳食组意见";
          if (citem.message && citem.taskName === "机关服务中心膳食组意见") {
            this.yjjy =
              "【" +
              citem.deptName +
              "-" +
              citem.realname +
              "】:" +
              (citem.message ? citem.message : "") +
              "。（" +
              citem.time +
              "）";
          }
        } else if (this.detailObj.subType === "3") {
          this.activeTaskName = "机关服务中心资产组意见";
          if (citem.message && citem.taskName === "机关服务中心资产组意见") {
            this.yjjy =
              "【" +
              citem.deptName +
              "-" +
              citem.realname +
              "】:" +
              (citem.message ? citem.message : "") +
              "。（" +
              citem.time +
              "）";
          }
        } else if (this.detailObj.subType === "4") {
          this.activeTaskName = "机关服务中心物业组意见";
          if (citem.message && citem.taskName === "机关服务中心物业组意见") {
            this.yjjy =
              "【" +
              citem.deptName +
              "-" +
              citem.realname +
              "】:" +
              (citem.message ? citem.message : "") +
              "。（" +
              citem.time +
              "）";
          }
        } else if (this.detailObj.subType === "0") {
          if (
            citem.taskName === "机关服务中心资产组意见" ||
            citem.taskName === "机关服务中心物业组意见" ||
            citem.taskName === "机关服务中心膳食组意见"
          ) {
            this.activeTaskName = citem.taskName;
            if (citem.message) {
              this.yjjy =
                "【" +
                citem.deptName +
                "-" +
                citem.realname +
                "】:" +
                (citem.message ? citem.message : "") +
                "。（" +
                citem.time +
                "）";
            }
          }
        }
      });
      this.zczyj = this.yjjy;
      // 办结节点
      // if (this.detailObj.canTodo && this.detailObj.taskConfig && this.detailObj.taskConfig.properties) {
      if (this.detailObj.taskName == "机关服务中心资产组意见") {
        this.bjFlag = true;
      }
      if (
        this.detailObj.taskName == "机关服务中心资产组意见" ||
        this.detailObj.taskName == "机关服务中心分管领导意见" ||
        this.detailObj.taskName == "机关服务中心经办人办理" ||
        this.detailObj.taskName == "发起人阅知办结" ||
        this.detailObj.taskName == "结束"
      ) {
        this.bjFlag1 = true;
      }
      // }
      //办结结束
      if (this.detailObj.status === "2") {
        this.form1 = Object.assign(this.form1, this.detailObj);
      }
    }
    this.init();
  },
  methods: {
    choseRy(val) {
      if (val == 3 || val == 4) {
        this.hrefUrl = "/templet/公有住房 承诺书（挂职借调人员）.docx";
      } else if (val == 5) {
        this.hrefUrl = "/templet/公有住房 承诺书 ( 劳务派遣员工）.docx";
      } else {
        this.hrefUrl = "/templet/公有住房 承诺书（在职干部、职工）.docx";
      }
    },
    choseHouse() {
      if (this.bjFlag) {
        this.getmemberList(this.page2);
        this.modalHouse1 = true;
      }
    },
    changeBed(value) {
      let list = this.optionsBed.filter((item) => {
        return item.bedId === value;
      });
      if (list.length > 0) {
        let att = Object.assign({}, list[0]);
        delete att.leadDate;
        delete att.remark;
        this.form1 = Object.assign(this.form1, att);
      }
    },
    selectMembers1(selectedRowKeys, selectedRows) {
      this.selectedRowKeys1 = selectedRowKeys;
      this.chosememberList1 = selectedRows;
    },
    handleTableChange1(pagination, filters, sorter) {
      this.page2.current = pagination.current;
      this.getmemberList(this.page2);
    },
    dataSubmit() {
      if (this.chosememberList1.length > 0) {
        this.form1.bedNumber = "";
        let att = Object.assign({}, this.chosememberList1[0]);
        delete att.leadDate;
        delete att.remark;
        this.form1 = Object.assign(this.form1, att);
        if (this.form1.housingType === "2") {
          fetchList({
            current: 1,
            size: 1000,
            housingId: this.form1.housingId,
            status: "0",
          }).then((response) => {
            this.optionsBed = response.data.data.records;
          });
        }
      }
      this.close1();
    },
    close1() {
      this.selectedRowKeys1 = [];
      this.chosememberList1 = [];
      this.modalHouse1 = false;
    },
    getmemberList(page, params) {
      fetchList1(
        Object.assign(
          {
            current: page.current,
            size: page.pageSize,
            status: "0",
          },
          params
        )
      ).then((response) => {
        response.data.data.records.map((item) => {
          item.housingTypeName = findByvalue(
            this.optionsHouseType,
            item.housingType
          );
          item.strueName = findByvalue(this.optionStru, item.structure);
          item.towaName = findByvalue(this.optionsTowa, item.toward);
          item.statusName = findByvalue(this.optionsStatus, item.status);
        });
        this.allmemberList1 = response.data.data.records;
        this.page2.total = response.data.data.total;
      });
    },
    handexceed() {
      this.$message.warning("仅允许上传一个文件");
    },
    handleSuccess(response, file, fileList) {
      this.ruleForm.attachment = fileList;
    },
    handleRemove(file, fileList) {
      this.ruleForm.attachment = fileList;
    },
    // 判断上传文字类型
    beforeUpload(file) {
      var fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
      const isFile = fileType === "wps";
      if (isFile) {
        this.centerDialogVisible = true;
        return false;
      }
    },
    download(file) {
      window.open(file.response.data.url);
    },
    handleSuccess1(response, file, fileList) {
      this.ruleForm.housing.promise = file.response.data.url;
      this.ruleForm.fileList1 = fileList;
    },
    handleRemove1(file, fileList) {
      this.ruleForm.housing.promise = "";
      this.ruleForm.fileList1 = [];
    },
    download1(file) {
      window.open(file.response.data.url);
    },
    handleSuccess2(response, file, fileList) {
      this.ruleForm.housing.applyForm = file.response.data.url;
      this.ruleForm.fileList2 = fileList;
    },
    handleRemove2(file, fileList) {
      this.ruleForm.housing.applyForm = "";
      this.ruleForm.fileList2 = [];
    },
    download2(file) {
      window.open(file.response.data.url);
    },
    handleAvatarSuccess(res, file, fileList) {
      this.avatarUrl = URL.createObjectURL(file.raw);
      this.cover = res.data.url;
      this.keyNum += 1;
    },
    deleteImg() {
      this.avatarUrl = "";
      this.cover = "";
    },
    close() {
      this.$emit("getItemModal", false);
    },
    init() {
      remote("personnel_type").then((response) => {
        this.optionRylb = response.data.data;
      });
      remote("housing_type").then((response) => {
        this.optionsHouseType = response.data.data;
      });
    },
    getPostName(id) {
      let list = this.optionsZw.filter((item) => {
        return item.id === id;
      });
      return list.length > 0 ? list[0].name : "";
    },
    submitForm(formName) {
      let _this = this;
      this.ruleForm.billChecked = [];
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (!_this.ruleForm.createTime) {
            _this.$message.error("请选择申请时间");
            return;
          }
          if (!_this.ruleForm.newStaffName) {
            _this.$message.error("请输入申请人");
            return;
          }
          if (!_this.ruleForm.newStaffPhone) {
            _this.$message.error("请输入申请人联系电话");
            return;
          }
          if (!_this.ruleForm.newStaffType) {
            _this.$message.error("请选择人员类型");
            return;
          }
          if (!_this.ruleForm.newStaffAddr) {
            _this.$message.error("请选择办公地点");
            return;
          }
          if (!_this.ruleForm.startDate) {
            _this.$message.error("请选择开始日期");
            return;
          }
          _this.ruleForm.applyTimes = [];
          _this.ruleForm.applyTimes.push(
            _this.ruleForm.startDate,
            _this.ruleForm.endDate
          );
          if (
            !_this.radio1 &&
            !_this.radio2 &&
            !_this.radio3 &&
            !_this.radio4
          ) {
            _this.$message.error("申请类型请至少选择一项");
            return;
          }
          if (_this.radio1) {
            _this.ruleForm.billChecked.push(1);
            if (!_this.ruleForm.idCard.roomNo) {
              _this.$message.error("请输入房间号");
              return;
            }
            if (!_this.cover) {
              _this.$message.error("请上传照片");
              return;
            } else {
              _this.ruleForm.idCard.pic = _this.cover;
            }
          }
          if (_this.radio2) {
            _this.ruleForm.billChecked.push(2);
          }
          if (_this.radio3) {
            _this.ruleForm.billChecked.push(3);
            if (!_this.ruleForm.housing.applyForm) {
              _this.$message.error("请上传公有住房申请表");
              return;
            }
            if (!this.ruleForm.housing.promise) {
              _this.$message.error("请上传个人住房承诺书");
              return;
            }
          }
          if (_this.radio4) {
            _this.ruleForm.billChecked.push(4);
            if (!_this.ruleForm.parking.plateNo) {
              _this.$message.error("请输入车牌号");
              return;
            }
          }
          if (
            !_this.detailObj.code ||
            (_this.detailObj &&
              _this.detailObj.taskName === "发起人" &&
              _this.detailObj.showSelectType)
          ) {
            if (!_this.assignee || _this.assignee.length === 0) {
              this.$message.error("请选择部门领导");
              return;
            } else {
              _this.formObj.assignee = _this.assignee.join();
            }
          }

          if (_this.formObj.taskName === "发起人") {
            let params = {
              billId: _this.formObj.billId,
              comment: "",
              flag: "提交",
              taskId: _this.formObj.taskId,
            };
            params.bizData = _this.ruleForm;
            params.assignee = _this.formObj.assignee;
            billSubmit(params).then((response) => {
              this.$message.success("处理成功");
              this.$router.go(-1);
            });
          } else {
            this.$confirm("确定提交?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(() => {
              _this.formObj.bizData = Object.assign({}, _this.ruleForm);
              _this.formObj.bizData.createTime =
                _this.ruleForm.createTime + " 00:00:00";
              startProcess(_this.formObj).then((response) => {
                this.$message.success("提交成功");
                this.close();
              });
            });
          }
        }
      });
    },
  },
};
</script>
<style lang="scss">
.tip-grey {
  color: #aaa;
  font-size: 12px;
}
.radio-group-custom {
  height: 50px;
  line-height: 57px;
}
.total-wrap {
  .el-form-item__content {
    text-align: center;
  }
  .no-border .el-form-item__content .el-row {
    .el-col:first-child {
      border-left: 0;
    }
  }

  .upload-content {
    position: relative;
    height: 151px;
    .upload-demo {
      height: 110px;
      position: absolute;
      width: 100%;
      top: 0;
    }
  }
  .upload-content-new {
    position: relative;
    height: 80px;
    .upload-demo-new {
      height: 80px;
      position: absolute;
      width: 100%;
      text-align: left;
      top: 0;
      .el-icon-close-tip {
        display: none !important;
      }
    }
  }
  .avatar-uploader-icon {
    height: 130px !important;
    width: 130px !important;
    border: 1px dashed #d9d9d9;
    line-height: 130px !important;
  }
  .url-block {
    position: absolute;
    bottom: 10px;
    left: 0px;
    text-decoration: underline;
    a {
      margin-right: 20px;
      text-decoration: underline;
    }
  }
  p.url-block {
    text-decoration: none;
    margin-bottom: 0;
  }
  label .url-block {
    text-decoration: none;
    margin-bottom: 0;
    bottom: 0;
    left: 5px;
    text-decoration: underline;
  }
  .avatar {
    display: inline-block;
    width: 130px;
    height: 130px;
  }
  .avatar-uploader .el-upload {
    border: 0;
  }
  .applyTimes-items .el-form-item__content {
    line-height: inherit;
  }
  .red-star:before {
    content: "*";
    color: #f56c6c;
    margin-right: 4px;
  }
  .error {
    height: 340px !important;
  }
}
.btn-group-col {
  .el-form-item__content {
    text-align: center;
  }
}
.render-form .jb-form-item .el-form-item__content .el-form-item__error {
  right: 155px;
}
.render-form .xm-form-item .el-form-item__content .el-form-item__error {
  right: 75px;
}
.render-form .xb-form-item .el-form-item__content .el-form-item__error {
  right: 15px;
}
.xm-form-item {
  .el-radio {
    margin-right: 10px;
  }
}
.flex-block {
  display: flex;
  justify-content: center;
  align-items: center;
}
.total-wrap {
  .el-form {
    position: relative;
    .disable-block {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      opacity: 0;
      height: 986px;
      z-index: 1;
      cursor: not-allowed;
    }
    .date-half-block {
      width: 30%;
      margin-right: 10px;
    }
  }
}

.btn-footer {
  text-align: center;
}
</style>

